package com.shiguiwu.springmybatis.designpattern.composite.scene.engine.impl;

import com.shiguiwu.springmybatis.designpattern.composite.scene.aggregates.TreeRich;
import com.shiguiwu.springmybatis.designpattern.composite.scene.engine.EngineBase;
import com.shiguiwu.springmybatis.designpattern.composite.scene.vo.EngineResult;
import com.shiguiwu.springmybatis.designpattern.composite.scene.vo.TreeNode;

import java.util.Map;

/**
 * @description: 引擎实现
 * @author: stone
 * @date: Created by 2021/8/26 20:40
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.designpattern.composite.scene.engine.impl
 */
public class TreeEngineHandle extends EngineBase {

    @Override
    public EngineResult process(Long treeId, String userId, TreeRich treeRich, Map<String, String> decisionMatter) {

        // 决策流程
        TreeNode treeNode = this.engineDecisionMaker(treeRich, treeId, userId, decisionMatter);

        // 决策结果
        return new EngineResult(userId, treeId, treeNode.getTreeNodeId(), treeNode.getNodeValue());
    }
}
